package com.xiaoshuidi.cloud.module.member.controller.admin.coupon.vo;

import com.alibaba.fastjson.JSONArray;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author Alex
 * @version generator
 * @description 优惠券记录Vo实体
 * @date 2023-03-15 16:08:44
 */
@Data
public class CouponRecordVo {

    @Schema(description = "优惠活动")
    private String couponName;

    @Schema(description = "发券人")
    private String issuerName;

    @Schema(description = "发券时间")
    private Date createTime;

    @Schema(description = "发放账户")
    private String issuerAccount;

    @Schema(description = "发券数量")
    private Long issuerNum;

    @Schema(description = "发券说明")
    private String remarks;

    @Schema(description = "发券凭证")
    private String couponUrl;

    @Schema(description = "租客昵称")
    private String nickName;

    public List<String> getCouponUrls() {
        if (StringUtils.isNotBlank(couponUrl)) {
            return JSONArray.parseArray(couponUrl, String.class);
        } else {
            return new ArrayList<>();
        }
    }
}
